package cn.tsinghua.david.gc.obj;

public class GCASPair {
	private GCAction action = null;
	private GCState state = null;
	
	public GCASPair(GCAction a, GCState s){
		this.action = a;
		this.state = s;
	}

	public GCAction getAction() {
		return action;
	}
	
	public void setAction(GCAction action) {
		this.action = action;
	}
	
	public GCState getState() {
		return state;
	}
	
	public void setState(GCState state) {
		this.state = state;
	}

	@Override
	public String toString() {
		return "[action=" + action.getStrActionDesc() + ", state=" + state.getStrStateDesc() + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((action == null) ? 0 : action.hashCode());
		result = prime * result + ((state == null) ? 0 : state.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GCASPair other = (GCASPair) obj;
		if (action == null) {
			if (other.action != null)
				return false;
		} else if (!action.equals(other.action))
			return false;
		if (state == null) {
			if (other.state != null)
				return false;
		} else if (!state.equals(other.state))
			return false;
		return true;
	}
	
	
	
}
